﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Example
{

    public struct test
    {
        public int version;
        public int x;
        public int y;
    }

    class Program
    {
        static void Main(string[] args)
        {
            test t = new test()
            {
                version = 100,
                x = 222,
                y = 333
            };

            string filename = "test.data";

            using (FileWriter fw = new FileWriter(filename))
            {
                fw.Write(t);
            }

            using(FileReader fr = new FileReader(filename) )
            {
                test tr = fr.Read<test>();
                Console.WriteLine("version:"+tr.version);
                Console.WriteLine("x:" + tr.x);
                Console.WriteLine("y:" + tr.y);
            }

            Console.ReadKey();
        }
    }
}
